package com.wteam.dragon.shop.search.bean;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * @Author 陈晓辉
 * @Date 2021/3/27 8:58
 */
@Data
@EqualsAndHashCode
@Document(indexName = "shop", replicas = 0)
@TableName("product")
public class EsProduct implements Serializable {
    @Id
    private Long id;

    @Field(type = FieldType.Keyword)
    private String productSn;

    @Field(type = FieldType.Keyword)
    private String brandName;

    private Long productSortId;

    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String name;

    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String subhead;

    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String keywords;

    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String brandNameEn;

    @Field(analyzer = "ik_max_word", type = FieldType.Text)
    private String productSortName;

    private String introduce;

    private BigDecimal price;

    private BigDecimal originalPrice;

    private Integer stock;

    private String unit;

    private BigDecimal weight;

    private Long sort;

    private String album;

    private String detail;

    private Integer publishStatus;

    private Integer newStatus;

    private Integer recommendStatus;

    private Long brandId;

    @Field(type = FieldType.Nested)
    @TableField(exist = false)
    private List<EsProductAttributeValue> attrValueList;

    @TableLogic
    private Boolean isDelete;
}
